package com.yc.navy.goods.message;

import java.util.Map;

import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.alibaba.fastjson.JSON;
import com.yc.navy.goods.service.IOrderInfoService;

@Component
public class RabbitMqReceiver {
	@Autowired
	private IOrderInfoService orderInfoService;
	
	@SuppressWarnings("unchecked")
	@RabbitListener(queuesToDeclare = @Queue("orderInfo"))
	public void process(String msg) {
		Map<String, Object> map = JSON.parseObject(msg, Map.class);
		orderInfoService.update(map);
	}
}
